/*
 * Write a C++ program to find the area
 * of a square, reactangle and triangle
 * using function overloading
 */

# include <iostream>
#include <cmath>
using namespace std;

class AreaCalc {
public:
  void get(int sd);
  void get(int wd, int ht);
  void get(int s1, int s2, int s3);
};

void AreaCalc::get(int sd) {
  cout << "Area of the square: " << (sd * sd) << endl;
}

void AreaCalc::get(int wd, int ht) {
  cout << "Area of the rectangle: " << (wd * ht) << endl;
}

void AreaCalc::get(int s1, int s2, int s3) {
	int s = (s1+s2+s3)/2;
  cout << "Area of the triangle: " << sqrt(s * (s - s1) * (s - s2) * (s - s3)) << endl;
}

int main() {
  int rad, wd, ht, s1, s2, s3;
  cout << "Enter side of the square: ";
  cin >> rad;
  cout << "Enter width of the rectangle: ";
  cin >> wd;
  cout << "Enter height of the rectangle: ";
  cin >> ht;
	cout << "Enter side 1 of the triangle: ";
  cin >> s1;
	cout << "Enter side 2 of the triangle: ";
  cin >> s2;
	cout << "Enter side 3 of the triangle: ";
  cin >> s3;
  AreaCalc ar;
  ar.get(rad);
  ar.get(wd, ht);
	ar.get(s1, s2, s3);
}

